package com.EVO.filter;


        import javax.servlet.*;
        import java.io.IOException;
        import java.io.PrintWriter;

public class Filter1 implements Filter {
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        String age = servletRequest.getParameter("age");
        servletRequest.setCharacterEncoding("utf-8");
        if(Integer.valueOf(age) < 70){
            //放行
            filterChain.doFilter(servletRequest,servletResponse);
        }else{
            servletResponse.setContentType("text/html;charset=utf-8");
            PrintWriter out = servletResponse.getWriter();
            out.print("<center><font style='color:red;font-size:40px'>您不适合观看此内容！！</font></center>");
        }
    }
}